<?php
/**
 * 免押金额度
 * User: tengyu
 * Date: 2017/9/1
 * Time: 13:27
 */?>
@extends('common.common')
@section('title','信用额度')
@section('css')<link rel="stylesheet" href="{{asset('/css/personal_deposit.css')}}">@endsection
@section('js')
    <script>
        function getzhima()
        {
            $("#getzhima").submit();
        }

        /**用户删除额度表数据，后台设置为不显示*/
        function quota_editisdel(id)
        {
            $.ajax({
                url:'/user/quota_editisdel/'+id,
                type:'get',
                dataType:'json',
                success:function(res)
                {
                    if(res.res=='ok'){
                        alert(res.msg);
                        history.go(0);
                    }else{
                        alert(res.msg);
                    }
                }
            });
        }
    </script>
@endsection
@section('content')
    <div id="content">
        @include('common.centernav')
        <h3>个人中心</h3>
        <div class="container">
            <div class="row">
            @include('usercenter.usersidebar')
            <!--2、右侧主体-->
                <div class="col-xs-9">
                    <!--右侧面版-->
                    <div id="panel" class="panel panel-default rightPanel">
                        <div class="panel-heading">
                            <h4>信用额度</h4>
                        </div>
                        @if (count($errors) > 0)
                            <div class="alert alert-danger text-left">
                                <strong>开通出错!</strong>
                                <ul>
                                    @if(is_object($errors))
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    @else
                                        <li>{{$errors}}</li>
                                    @endif
                                </ul>
                            </div>
                        @endif
                        <div class="panel-body bodyone">
                            @if($param['quota_apply_dt'])
                                <p>
                                    <span class="spanWidth">免押金额度审批状态:</span>
                                    @if($param['quota_apply_dt']->status==0)
                                    <span class="red">审核中</span>
                                    @else
                                    <span class="red">审核完成</span>
                                    @endif
                                    <a class="btn btn-warning pull-right" href="{{url('/user/quota_apply')}}">查看详情</a>
                                </p>
                                @if($param['quota'] && $param['quota_apply_dt']->status==1)
                                <p>
                                    <span class="spanWidth">现有额度：</span>
                                    <span class="red">{{$param['quota']->quota_current}}</span>
                                    <a class="btn btn-warning pull-right" href="{{url('/user/quota_add')}}">申请提升额度</a>
                                </p>
                                @endif
                                <p>
                                    <span class="spanWidth">面签：</span>
                                    <span class="red">暂不面签</span>
                                </p>
                               @if(!empty($param['quota_apply_dt']) && (!empty($param['quota']) && $param['quota']->quota_zhima>0))
                                <p>
                                    <span class="spanWidth">芝麻信用：</span>
                                    <span class="red">{{$param['quota']->quota_zhima}}</span>
                                </p>
                                @else
                                <p>
                                    <span class="spanWidth">芝麻信用：</span>
                                    <span class="red">0</span>
                                    <button data-toggle="modal" data-target="#depositModalBox" class="btn btn-warning pull-right">立即开通</button>
                                </p>
                                @endif
                            @endif
                        </div>
                        <div class="panel-heading">
                            <h4>额度使用列表</h4>
                        </div>
                        <div class="panel-body">
                            <ul class="product list-inline">
                                <li>商品信息</li>
                                <li>已使用额度</li>
                                <li>订单状态</li>
                                <li>操作</li>
                            </ul>
                            <!--列表组-->
                            @if( isset($param['quota_data_dt']) && count($param['quota_data_dt']))
                                @foreach($param['quota_data_dt'] as $v)
                                <ul class="orders list-inline">
                                <li class="imgInfo">
                                    <div class="media">
                                        <div class="media-left">
                                            <img src="{{asset(env('STATIC_FILE_ERP_PATH').$v->fitment_details_imgMaster)}}" style="width: 151px;height: 92px;">
                                        </div>
                                        <div class="media-body">
                                            <p>{{$v->fitments_name}}</p>
                                            <p><img src="/img/color.jpg"></p>
                                            @if($v->details_rent_type==1)
                                            <p>¥<span>{{$v->details_nimbleprice}}</span>/月</p>
                                            @else
                                            <p>¥<span>{{$v->details_fixprice}}</span>/月</p>
                                            @endif
                                        </div>
                                    </div>
                                </li>
                                <li>-&nbsp;¥<span>&nbsp;{{$v->quota_detail_amount}}</span></li>
                                @if($v->orders_status>0)
                                <li>已支付</li>
                                @else
                                <li>未支付</li>
                                @endif
                                <li><span onclick="quota_editisdel({{$v->quota_detail_id}})">&times;</span></li>
                            </ul>
                            @endforeach
                            @else
                                <ul class="text-center">
                                    <img src="{{asset('/img/771509094256_.pic.jpg')}}" alt="暂无数据">
                                </ul>
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="depositModalBox" class="modal" data-backdrop="static">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <span class="close" data-dismiss="modal">&times;</span>
                    <h4 class="modal-title">申请提升额度</h4>
                </div>
                <div class="modal-body">
                    <div class="container-fluid">
                        <img src="/img/zmxy.png" class="img-responsive">
                        <p class="words">尊敬的客户您好，请您授权芈租界查看您的芝麻信用分，我们会根据您的芝麻信用分给您授予免押金额度，谢谢您的配合。</p>
                    </div>
                    <form class="form-inline" action="{{url('/user/getzhima')}}" type="get" id="getzhima">
                        <div class="form-group">
                            <label class="control-label">姓名：</label>
                            <input type="text" class="form-control" name="quota_apply_name" value="{{$param['quota_apply_dt']->username}}" readonly>
                        </div>
                        <br><br>
                        <div class="form-group">
                            <label class="control-label">身份证号：</label>
                            <input type="text" class="form-control" name="quota_apply_ident" value="{{$param['quota_apply_dt']->identificatiomn}}" readonly>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-success" data-dismiss="modal" onclick="getzhima()">授权我的芝麻信用分</button>
                </div>
            </div>
        </div>
    </div>
@endsection
